package com.lzh.controller;

import com.lzh.bean.Department;
import com.lzh.bean.Msg;
import com.lzh.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author reborn
 * @create 2020/3/11-21:35
 * 处理和部门有关的请求
 */

@Controller
public class DeptController {

    @Autowired
    private DepartmentService departmentService;

    @RequestMapping("/depts")
    @ResponseBody//返回给浏览器
    public Msg getDepts(){
        List<Department> list=departmentService.getDept();
        return Msg.success().add("depts",list);
    }
}
